import os

ROOT_PATH = os.path.dirname(os.path.dirname(__file__))
RESOURCE_PATH = os.path.join(ROOT_PATH, "resources")
STYLESHEET_PATH = os.path.join(ROOT_PATH, "styles")
UI_PATH = os.path.join(ROOT_PATH, "ui")

def load_stylesheet(widget):
    """加载样式表文件"""
    try:
        style_path = os.path.join(STYLESHEET_PATH, "style.qss")
        if os.path.exists(style_path):
            with open(style_path, "r", encoding="utf-8") as f:
                style = f.read()
                widget.setStyleSheet(style)
                print("样式表加载成功")
        else:
            print(f"样式表文件不存在: {style_path}")
    except Exception as e:
        print(f"加载样式表时出错: {e}")

def get_resource(path):
    return os.path.join(RESOURCE_PATH, path)

def get_stylesheet(path):
    return os.path.join(STYLESHEET_PATH, path)

def get_ui(path):
    return os.path.join(UI_PATH, path)


